<!DOCTYPE html>
<html>
	<head>
	  <meta charset="utf-8">
	  <title>Layui</title>
	  <meta name="renderer" content="webkit">
	  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	  <link rel="stylesheet" href="../layui/css/layui.css" media="all">
	  <script>
		
	  
	  </script>
	  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
	</head>
	<body >
		<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
			<legend>余额查询</legend>
		</fieldset>
		 
		<form class="layui-form" action="" lay-filter="example">
		  <div class="layui-form-item">
		    <label class="layui-form-label">账户余额:</label>
		    <div class="layui-input-block" >
		      <!-- <input type="text" name="oldPassword" id="oldPassword" lay-verify="title" style="display: inline-block; float: left;" autocomplete="off" placeholder="请输入旧密码"  class="layui-input"> -->
		    <!-- <span id='pwdText' style="display: inline-block; text-align: left; padding-top: 8px;">123</span> -->
			<span style='color:red; display:inline-block; text-align: left; padding-top: 10px;'id="myBalance"></span>
			</div>
			
		  <div class="layui-form-item">
		    <div class="layui-input-block">
				 <!-- <button type="reset" class="layui-btn layui-btn-primary">重置</button> -->
		      <button id="save" lay-filter="update" class="layui-btn" lay-submit="" >充值</button>
		    </div>
		  </div>
		</form>
		
		<script src="../layui/layui.js" charset="utf-8"></script>
		<!-- <script type="text/javascript" src="layui/js/jquery-1.8.3.min.js"></script> -->
		<!-- 注意：如果你直接复制所有代码到本地，上述 JS 路径需要改成你本地的 -->
		<script>
		let value = localStorage.getItem("user");
		var user = JSON.parse(value);
		
		
		layui.use(['form', 'layedit', 'laydate'], function(){
		  var form = layui.form
		  ,isCheck = false
		  ,layer = layui.layer
		  ,$ = layui.jquery
		  ,layedit = layui.layedit
		  ,laydate = layui.laydate;
		  
		  //获得个人余额
		  	$(document).ready(function(){
		  	var $ = layui.jquery;
		  	var value = localStorage.getItem("user");
		  	 var user = JSON.parse(value);
		  	 $.ajax({
		  		url: 'http://localhost:8085/userBalance/findBalance',
		  		data: {userId:user.userId},
		  		type:'GET',
		  		 dataType:"json",
		  		 timeout:300000,
		  		 success:function(result) {
		  			 console.log(result.data);
		  		 		$('#myBalance').html(result.data)
		  		 }
		  	 });
		  	
		  });
		  
		  $('#save').click(function(){
					// layer.open({
					//        type: 2,
					//        title: '充值服务',
					//        shadeClose: false,
					//        shade: 0.6,
					//        area: ['500px', '500px'],
					//        content: 'recharge.html',
									
					//    });
					window.open("recharge.html",'top')
					   return false;
		  })
	  
	  
		});
		
		</script>
		<style>
		
		.layui-input{
			width:35%
		}
		
				
		
		
		
		</style>
	</body>
</html>



